{%extend name="Public:layout"/%}

{%block name="title"%}
<h2 class="mb20">
    评论统计
</h2>
{%/block%}

{%block name="contents"%}
<ul class="nav nav-tabs mb20">
    <li class='{%eq name="type" value="1"%}active{%/eq%}'><a href="{%:U('/admin/statisticcomment/getlist/')%}?type=1&start_time={%$start_time%}&end_time={%$end_time%}">彩蛋</a></li>
    <li class='{%eq name="type" value="2"%}active{%/eq%}'><a href="{%:U('/admin/statisticcomment/getlist/')%}?type=2&start_time={%$start_time%}&end_time={%$end_time%}">资讯</a></li>
    <li class='{%eq name="type" value="3"%}active{%/eq%}'><a href="{%:U('/admin/statisticcomment/getlist/')%}?type=3&start_time={%$start_time%}&end_time={%$end_time%}">剧透</a></li>
</ul>
<div class="heading clearfix">
    <div class="pull-left">
        <form class="form-inline" onsubmit="return false;" stverify="true" method="get" action="">
            <input type="hidden" name="type" value="{%$type%}" />
            <input class="input input-small" id="start_time" name="start_time" value="{%$start_time%}" placeholder="开始时间" type="text" />
            <input class="input input-small" id="end_time" name="end_time" value="{%$end_time%}" placeholder="结束时间" type="text" />
            <input class="input input-small" type="text" name="id" value="{%$id%}" placeholder="id号" />
            <input type="submit" class="btn" value="搜索">
        </form>
    </div>
    <div class="pull-right">
    </div>
</div>
<div id="placeholder" class="mb20" style="height:400px;"></div>
<ul class="nav nav-tabs mb20" id="_tabs">
    <!--{%foreach name="labelData" item="data"%}-->
    <li class='{%empty name="start"%}active{%/empty%}'><a href="javascript:;">{%$data[0]%}</a></li>
    <!--{%php%}$start=1;{%/php%}-->
    <!--{%/foreach%}-->
</ul>
<!--{%foreach name="labelData" item="data" key="intId"%}-->
<div class="fn_tab_content" style='{%notempty name="start2"%}display: none;{%/notempty%}'>
<table class="table table-listing table-hovered">
    <thead class="thead-gray">
    <tr>
        <th>日期</th>
        <th>数量</th>
        <th>查看</th>
    </tr>
    </thead>
    <tbody>
    {%notempty name="data[1]"%}
    {%php%}$all = 0;{%/php%}
    {%foreach name="data[1]" item="vo"%}
    <tr>
        <td>{%$vo.ymd%}</td>
        <td>{%$vo.num%}</td>
        <td><a href="{%:U('/admin/statisticcomment/getlist/')%}?type={%$type%}&id={%$intId%}&day={%$vo.ymd%}" onclick="ST.msgbox({action:this.href},[],850,650,true);return false;">日报表</a></td>
    </tr>
    {%php%}$all += $vo['num'];{%/php%}
    {%/foreach%}
    <tr>
        <td></td>
        <td>合计:{%$all%}</td>
        <td></td>
    </tr>
    {%/notempty%}
    </tbody>
</table>
</div>
<!--{%php%}$start2=1;{%/php%}-->
<!--{%/foreach%}-->
<h2 class="m20"></h2>
<div class="paging">{%$page%}</div>
{%/block%}

{%block name="js"%}
<script type="text/plain" id="j_ueditorupload" style="display:none;"></script>
<script src="__JAVASCRIPT__/ueditor/ueditor.config.js"></script>
<script src="__JAVASCRIPT__/ueditor/ueditor.all.min.js"></script>
<script src="__JAVASCRIPT__/ST.Calender.js"></script>
<script type="text/javascript" src="__JAVASCRIPT__/flot/jquery.flot.js"></script>
<script type="text/javascript" src="__JAVASCRIPT__/flot/jquery.flot.time.js"></script>
<!--[if lte IE 8]>
<script language="javascript" type="text/javascript" src="__JAVASCRIPT__/flot/excanvas.min.js"></script>
<![endif]-->
<script src="__JAVASCRIPT__/ST.Tabs.js"></script>
<script>
    ST.addDateRange({
        bid: 'start_time',
        eid: 'end_time'
    });
    new ST.Tabs({
        ts:'#_tabs',
        el:'li',
        curClass:'active',
        evType:"click",
        sfun:function(node,i){
            var conts = $('.fn_tab_content');
            conts.hide().eq(i).show();
        }
    });
    var data, labelData = [];
    <!--{%foreach name="labelData" item="data"%}-->
    data = [];
    <!--{%foreach name="data[1]" item="vo"%}-->
    data.push(["{%$vo.ymd|strtotime%}000", '{%$vo.num%}']);
    <!--{%/foreach%}-->
    labelData.push({label: "{%$data[0]%}", data: data});
    <!--{%/foreach%}-->

    ST.plotChart('#placeholder', labelData);

    $.extend(ST.ACTION, {
        'publish': "{%:U('/admin/selfshot/publish')%}",
        'del': "{%:U('/admin/selfshot/record_del')%}",//删除目录action地址
        'save': "{%:U('/admin/selfshot/save')%}"//添加目录弹窗地址
    });
    $.extend(ST, {
        save: function (id) {
            ST.editBox(ST.ACTION.save + '/comic_id/' + id, {
                title: id == 0 ? '添加' : '修改',
                height: 500
            });
        },
        publish: function (id) {
            ST.execAJAX({
                url: ST.ACTION.publish,     //服务端请求地址
                params: {id: id},       //发送到服务端的参数（如：{myparam:1}）
                hasconfirm: false,
                succFun: function (j) {  //成功后的回调方法：刷新页面
                    if (!j) return;
                    if (j.data && j.data.url) {
                        location.href = j.data.url;
                    } else {
                        ST.reload();
                    }
                }
            });
        },
        del: function (id) {
            ST.execAJAX({
                url: ST.ACTION.del,     //服务端请求地址
                params: {id: id},       //发送到服务端的参数（如：{myparam:1}）
                massage: '确定删除吗？',       //提示信息（仅hasconfirm为true时有用）
                hasconfirm: true,       //提交前是否显示确认框
                succFun: function (j) {  //成功后的回调方法：刷新页面
                    if (!j) return;
                    if (j.data && j.data.url) {
                        location.href = j.data.url;
                    } else {
                        ST.reload();
                    }
                }
            });
        },
        //批量删除
        delAll: function () {
            var ids = ST.getSelectedValue().join(',');
            if (!ids) {
                ST.tipMsg('请至少选择一项');
            } else {
                ST.del(ids);
            }
        },
        //获得选中值
        getSelectedValue: function () {
            var $options = $('.js-toggleall-target:checked'), arr = [];
            $options.each(function () {
                arr.push($(this).val());
            });
            return arr;
        }
    });
    ST.init();
</script>
{%/block%}